﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Xml;

/// <summary>
///FlashBasePage 的摘要说明
/// </summary>
public class FlashBasePage : BasePage
{
    protected string type = "0";
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/xml";

        result = doc.CreateElement("result");
        try
        {
            doXml(sender, e);
        }
        catch
        {

        }
        XmlAttribute typeAttribute = doc.CreateAttribute("type");
        typeAttribute.Value = type;
        result.Attributes.Append(typeAttribute);
        doc.AppendChild(result);
        Response.Write(doc.OuterXml);
        Response.End(); 
        return;
    }
    private XmlDocument doc;
    private XmlNode result;
    protected XmlDocument GetDoc()
    {
        return doc;
    }
    public FlashBasePage()
    {
        doc = new XmlDocument();
        XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
        doc.AppendChild(decl);
        
    }
    protected XmlNode CreateElement(string name)
    {
        return doc.CreateElement(name);
    }
    protected XmlNode AppendChild(XmlNode node)
    {
        return result.AppendChild(node);
    }
    
    protected virtual void doXml(object sender, EventArgs e)
    {// Flash Xml
        type = "0";
    }

    protected string GetUploadfileImg()
    {
        return Server.MapPath("~/uploadfile/cms/image/");
    }
    protected string GetUploadfileFile()
    {
        return Server.MapPath("~/uploadfile/cms/file/");
    }
}
